const Koa = require('koa')
const views = require('koa-views')
const Router = require('koa-router')
const bodyParser = require('koa-bodyparser')
const payRouter = require('./routes/pay')

const app = new Koa()

app.use(views('./views', {
  extension: 'ejs'
}))

app.use(bodyParser())


// 路由中间件尽量定义在其他中间件的下面
const router = new Router()
router.use('/wxpay', payRouter.routes())

app.use(router.routes())

app.listen(3333, () => {
  console.log('localhost:3333')
})